package org.deschutter.hibernate;

import javax.persistence.Column;
import javax.persistence.Id;
import java.io.Serializable;

/**
 * User: Berten De Schutter
 * Date: 01-Oct-2009
 * Time: 13:38:07
 */
public class AlliancesHistoryPK implements Serializable {
    private String name;

    @Column(name = "name")
    @Id
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    private int tick;

    @Column(name = "tick")
    @Id
    public int getTick() {
        return tick;
    }

    public void setTick(int tick) {
        this.tick = tick;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AlliancesHistoryPK that = (AlliancesHistoryPK) o;

        if (tick != that.tick) return false;
        if (name != null ? !name.equals(that.name) : that.name != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = name != null ? name.hashCode() : 0;
        result = 31 * result + tick;
        return result;
    }
}
